package n2635;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	
	static int prim[]=new int[1000001];
	
	static boolean is[]=new boolean[1000001];
	
	static int count;
	
	static void initprim()
	{
		Arrays.fill(is, true);
		int sqrt=(int)Math.sqrt(1000000);
		for(int i=2;i<=sqrt;i++)
		{
			if(is[i])
			{
				for(int j=i*i;j<1000001;j+=i)
				{
					is[j]=false;
				}
			}
		}
		int k=0;
		for(int i=2;i<1000001;i++)
		{
			if(is[i])
			{
				prim[k++]=i;
			}
		}
		count=k;
	}
	
	static int solve(BigInteger k,int l)
	{
		boolean flag=true;
		int i=0;
		for(;i<count&&prim[i]<l&&BigInteger.valueOf(prim[i]).compareTo(k)<0;i++)
		{
			if(k.mod(BigInteger.valueOf(prim[i])).equals(BigInteger.ZERO))
			{
				flag=false;
				break;
			}
		}
		if(flag){
			return -1;
		}else{
			return prim[i];
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		
		initprim();
		
		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		String line=null;
		while((line=bf.readLine())!=null)
		{
			StringTokenizer st=new StringTokenizer(line);
			BigInteger k= new BigInteger(st.nextToken());
			int l=Integer.parseInt(st.nextToken());
			if(k.equals(BigInteger.ZERO)&&l==0)break;
			int r=solve(k, l);
			if(r!=-1)
			{
				System.out.println("BAD "+r);
			}else{
				System.out.println("GOOD");
			}
		}

	}

}
